﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Test13
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ha = new Hashtable();
            ha.Add(001,"小葵");
            ha.Add(002, "大奎");
            ha.Add(003, "小鬼");
            ha.Add(004, "小陈");
            ha.Add(005, "小俊");
            Console.WriteLine("请输入学生编号：");
            int id = int.Parse(Console.ReadLine());
            bool studen = ha.ContainsKey(id);
            if (studen )
            {
                Console.WriteLine("你查找的学生是：{0}",ha[id ].ToString ());
            }else
            {
                Console.WriteLine("对不起，没有你要查找的学生编号！");
            }
            Console.WriteLine("所有的学生信息如下：");
            foreach (DictionaryEntry i in ha)
            {
                int key = (int)i.Key ;
                string value = i .Value.ToString();
                Console.WriteLine("学生编号：{0}，学生名称：{1}", key, value);
            }
        }
    }
}
